package org.example.error;
//包装器义务异常类实现
public class BusinessException extends Exception implements CommonError{


    private CommonError commonError;
    //直接接受EmBusinessError的传参用于构造义务异常
    public BusinessException(CommonError commonError){
        super();
        this.commonError=commonError;
    }

    //直接自定义ErrorMsg的传参用于构造义务异常
    public BusinessException(CommonError commonError,String errMsg)
    {
        super();
        this.commonError=commonError;
        this.commonError.setErrMsg(errMsg);
    }
    @Override
    public int getErrCode() {
        return commonError.getErrCode();
    }

    @Override
    public String getErrMsg() {
        return commonError.getErrMsg();
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
        this.commonError.setErrMsg(errMsg);
        return this;
    }
}
